<?php
$this->breadcrumbs=array(
	'Usuários'=>array('index'),
	'Gerenciar',
);

$this->menu=array(
	array('label'=>'Cadastrar Usuário', 'url'=>array('create')),
	array('label'=>'Gerenciar Usuários', 'url'=>array('admin')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('tbl-user-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Gerenciar usuários</h1>


<?php 
// echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php 
// $this->renderPartial('_search',array(
//	'model'=>$model,
//)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'tbl-user-grid',
        'pager' => array('cssFile' => Yii::app()->baseUrl . '/themes/'.Yii::app()->theme->name.'/gridView.css'),
        'cssFile' => Yii::app()->baseUrl . '/themes/'.Yii::app()->theme->name.'/css/gridView.css',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id',
		'username',
                'nome',
		'email',
		'profile',
            	 array(
                    'name'=>'img',
                    'type'=>'image',
                    'value'=> 'Yii::app()->baseUrl. "/images/".$data->img',  
                ),
                array(
                       'name'=>'party',
                       'type'=>'raw',
                       'value'=>'CHtml::encode(cad_grupos::loadTableGrupos($data->party))'
                    ),
                array(
                       'name'=>'classe',
                       'type'=>'raw',
                       'value'=>'CHtml::encode(cad_parceiros::loadTableParceiro($data->classe))'
                    ),            
		array(
			'class'=>'CButtonColumn',
                        'afterDelete'=>'function(link,success,data){ if(success) alert("Delete completed successfuly"); }',
		),
	),
)); ?>
